package com.example.gzysmartcity.ui.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public class MainVp2Adapter extends FragmentStateAdapter {
    private final List<Fragment> list;

    public MainVp2Adapter(@NonNull @NotNull FragmentManager fragmentManager,
                          @NonNull @NotNull Lifecycle lifecycle,List<Fragment>list) {
        super(fragmentManager, lifecycle);
        this.list = list;
    }

    @NonNull
    @NotNull
    @Override
    public Fragment createFragment(int position) {
        return list.get(position);
    }

    @Override
    public int getItemCount() {
        return list.size();
    }
}
